{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from keras.models import Model\n",
    "from keras.layers import Input\n",
    "from keras.layers.convolutional import UpSampling3D\n",
    "from keras import backend as K\n",
    "import json\n",
    "from collections import OrderedDict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def format_decimal(arr, places=6):\n",
    "    return [round(x * 10**places) / 10**places for x in arr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "DATA = OrderedDict()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### UpSampling3D"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling3D.0] size 2x2x2 upsampling on 2x2x2x3 input, data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (2, 2, 2, 3)\n",
      "in: [-0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858]\n",
      "out shape: (4, 4, 4, 3)\n",
      "out: [-0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, -0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (2, 2, 2, 3)\n",
    "L = UpSampling3D(size=(2, 2, 2), data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(260)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling3D.0'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling3D.1] size 2x2x2 upsampling on 2x2x2x3 input, data_format='channels_first'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (2, 2, 2, 3)\n",
      "in: [0.601872, -0.028379, 0.654213, 0.217731, -0.864161, 0.422013, 0.888312, -0.714141, -0.184753, 0.224845, -0.221123, -0.847943, -0.511334, -0.871723, -0.597589, -0.889034, -0.544887, -0.004798, 0.406639, -0.35285, 0.648562, 0.325102, -0.691014, -0.77342]\n",
      "out shape: (2, 4, 4, 6)\n",
      "out: [0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (2, 2, 2, 3)\n",
    "L = UpSampling3D(size=(2, 2, 2), data_format='channels_first')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(261)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling3D.1'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling3D.2] size 1x3x2 upsampling on 2x1x3x2 input, data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (2, 1, 3, 2)\n",
      "in: [-0.989173, -0.133618, -0.505338, 0.023259, 0.503982, -0.303769, -0.436321, 0.793911, 0.416102, 0.806405, -0.098342, -0.738022]\n",
      "out shape: (2, 3, 6, 2)\n",
      "out: [-0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (2, 1, 3, 2)\n",
    "L = UpSampling3D(size=(1, 3, 2), data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(252)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling3D.2'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling3D.3] size 2x1x2 upsampling on 2x1x3x3 input, data_format='channels_first'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (2, 1, 3, 3)\n",
      "in: [-0.47588, 0.366985, 0.040173, 0.015578, -0.906159, 0.241982, -0.771299, -0.443554, -0.56404, -0.17751, 0.541277, -0.233327, 0.024369, 0.858275, 0.496191, 0.980574, -0.59522, 0.480899]\n",
      "out shape: (2, 2, 3, 6)\n",
      "out: [-0.47588, -0.47588, 0.366985, 0.366985, 0.040173, 0.040173, 0.015578, 0.015578, -0.906159, -0.906159, 0.241982, 0.241982, -0.771299, -0.771299, -0.443554, -0.443554, -0.56404, -0.56404, -0.47588, -0.47588, 0.366985, 0.366985, 0.040173, 0.040173, 0.015578, 0.015578, -0.906159, -0.906159, 0.241982, 0.241982, -0.771299, -0.771299, -0.443554, -0.443554, -0.56404, -0.56404, -0.17751, -0.17751, 0.541277, 0.541277, -0.233327, -0.233327, 0.024369, 0.024369, 0.858275, 0.858275, 0.496191, 0.496191, 0.980574, 0.980574, -0.59522, -0.59522, 0.480899, 0.480899, -0.17751, -0.17751, 0.541277, 0.541277, -0.233327, -0.233327, 0.024369, 0.024369, 0.858275, 0.858275, 0.496191, 0.496191, 0.980574, 0.980574, -0.59522, -0.59522, 0.480899, 0.480899]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (2, 1, 3, 3)\n",
    "L = UpSampling3D(size=(2, 1, 2), data_format='channels_first')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(253)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling3D.3'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.UpSampling3D.4] size 2 upsampling on 2x1x3x2 input, data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (2, 1, 3, 2)\n",
      "in: [0.024124, 0.280236, -0.680013, -0.042458, -0.164273, 0.358409, 0.511014, -0.585272, -0.481578, 0.692702, 0.64189, -0.400252]\n",
      "out shape: (4, 2, 6, 2)\n",
      "out: [0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (2, 1, 3, 2)\n",
    "L = UpSampling3D(size=2, data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(254)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.UpSampling3D.4'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### export for Keras.js tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "filename = '../../../test/data/layers/convolutional/UpSampling3D.json'\n",
    "if not os.path.exists(os.path.dirname(filename)):\n",
    "    os.makedirs(os.path.dirname(filename))\n",
    "with open(filename, 'w') as f:\n",
    "    json.dump(DATA, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"convolutional.UpSampling3D.0\": {\"input\": {\"data\": [-0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858], \"shape\": [2, 2, 2, 3]}, \"expected\": {\"data\": [-0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, -0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.806777, -0.564841, -0.481331, -0.806777, -0.564841, -0.481331, 0.559626, 0.274958, -0.659222, 0.559626, 0.274958, -0.659222, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, -0.178541, 0.689453, -0.028873, -0.178541, 0.689453, -0.028873, 0.053859, -0.446394, -0.53406, 0.053859, -0.446394, -0.53406, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, 0.776897, -0.700858, -0.802179, 0.776897, -0.700858, -0.802179, -0.616515, 0.718677, 0.303042, -0.616515, 0.718677, 0.303042, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858, -0.080606, -0.850593, -0.795971, -0.080606, -0.850593, -0.795971, 0.860487, -0.90685, 0.89858, 0.860487, -0.90685, 0.89858], \"shape\": [4, 4, 4, 3]}}, \"convolutional.UpSampling3D.1\": {\"input\": {\"data\": [0.601872, -0.028379, 0.654213, 0.217731, -0.864161, 0.422013, 0.888312, -0.714141, -0.184753, 0.224845, -0.221123, -0.847943, -0.511334, -0.871723, -0.597589, -0.889034, -0.544887, -0.004798, 0.406639, -0.35285, 0.648562, 0.325102, -0.691014, -0.77342], \"shape\": [2, 2, 2, 3]}, \"expected\": {\"data\": [0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.601872, 0.601872, -0.028379, -0.028379, 0.654213, 0.654213, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.217731, 0.217731, -0.864161, -0.864161, 0.422013, 0.422013, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.888312, 0.888312, -0.714141, -0.714141, -0.184753, -0.184753, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, 0.224845, 0.224845, -0.221123, -0.221123, -0.847943, -0.847943, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.511334, -0.511334, -0.871723, -0.871723, -0.597589, -0.597589, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, -0.889034, -0.889034, -0.544887, -0.544887, -0.004798, -0.004798, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.406639, 0.406639, -0.35285, -0.35285, 0.648562, 0.648562, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342, 0.325102, 0.325102, -0.691014, -0.691014, -0.77342, -0.77342], \"shape\": [2, 4, 4, 6]}}, \"convolutional.UpSampling3D.2\": {\"input\": {\"data\": [-0.989173, -0.133618, -0.505338, 0.023259, 0.503982, -0.303769, -0.436321, 0.793911, 0.416102, 0.806405, -0.098342, -0.738022], \"shape\": [2, 1, 3, 2]}, \"expected\": {\"data\": [-0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.989173, -0.133618, -0.989173, -0.133618, -0.505338, 0.023259, -0.505338, 0.023259, 0.503982, -0.303769, 0.503982, -0.303769, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022, -0.436321, 0.793911, -0.436321, 0.793911, 0.416102, 0.806405, 0.416102, 0.806405, -0.098342, -0.738022, -0.098342, -0.738022], \"shape\": [2, 3, 6, 2]}}, \"convolutional.UpSampling3D.3\": {\"input\": {\"data\": [-0.47588, 0.366985, 0.040173, 0.015578, -0.906159, 0.241982, -0.771299, -0.443554, -0.56404, -0.17751, 0.541277, -0.233327, 0.024369, 0.858275, 0.496191, 0.980574, -0.59522, 0.480899], \"shape\": [2, 1, 3, 3]}, \"expected\": {\"data\": [-0.47588, -0.47588, 0.366985, 0.366985, 0.040173, 0.040173, 0.015578, 0.015578, -0.906159, -0.906159, 0.241982, 0.241982, -0.771299, -0.771299, -0.443554, -0.443554, -0.56404, -0.56404, -0.47588, -0.47588, 0.366985, 0.366985, 0.040173, 0.040173, 0.015578, 0.015578, -0.906159, -0.906159, 0.241982, 0.241982, -0.771299, -0.771299, -0.443554, -0.443554, -0.56404, -0.56404, -0.17751, -0.17751, 0.541277, 0.541277, -0.233327, -0.233327, 0.024369, 0.024369, 0.858275, 0.858275, 0.496191, 0.496191, 0.980574, 0.980574, -0.59522, -0.59522, 0.480899, 0.480899, -0.17751, -0.17751, 0.541277, 0.541277, -0.233327, -0.233327, 0.024369, 0.024369, 0.858275, 0.858275, 0.496191, 0.496191, 0.980574, 0.980574, -0.59522, -0.59522, 0.480899, 0.480899], \"shape\": [2, 2, 3, 6]}}, \"convolutional.UpSampling3D.4\": {\"input\": {\"data\": [0.024124, 0.280236, -0.680013, -0.042458, -0.164273, 0.358409, 0.511014, -0.585272, -0.481578, 0.692702, 0.64189, -0.400252], \"shape\": [2, 1, 3, 2]}, \"expected\": {\"data\": [0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.024124, 0.280236, 0.024124, 0.280236, -0.680013, -0.042458, -0.680013, -0.042458, -0.164273, 0.358409, -0.164273, 0.358409, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252, 0.511014, -0.585272, 0.511014, -0.585272, -0.481578, 0.692702, -0.481578, 0.692702, 0.64189, -0.400252, 0.64189, -0.400252], \"shape\": [4, 2, 6, 2]}}}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(DATA))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
